<template>
  <div class="body">
    <el-row v-if="diagnosisForm.length === 0" class="form">
      <el-row class="form-row" type="flex" justify="space-between">
        <div class="form-title">诊断</div>
        <div>
          <el-button type="primary" @click="addDiagnosis()"> 新增 </el-button>
        </div>
      </el-row>
      <el-row class="no-data">
        <h3 align="center">无数据</h3>
      </el-row>
    </el-row>
    <div
      v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
      :key="'diagnosis' + diagnosisFormIndex"
      :model="diagnosisForm[diagnosisFormIndex]"
    >
      <el-row class="form">
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">诊断</div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addDiagnosis()"> 新增 </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length == 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>

        <el-form label-width="80px">
          <el-row class="card">
            <el-row class="card-title" type="flex">
              <el-col :sm="22" class="right">
                <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                <div class="content">{{ diagnosisFormItem.department }}</div>
              </el-col>
              <el-col :sm="2" class="right">
                <el-button
                  type="primary"
                  @click="saveOther(diagnosisForm[diagnosisFormIndex])"
                >
                  保存
                </el-button>
              </el-col>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-checkbox
                  v-model="diagnosisForm[diagnosisFormIndex].cerebralInfarction"
                  true-label="1"
                  false-label=""
                  @change="diagnosisKnown(diagnosisFormIndex, '脑梗死')"
                >脑梗死</el-checkbox>
                <el-checkbox
                  v-model="diagnosisForm[diagnosisFormIndex].hematencephalon"
                  true-label="1"
                  false-label=""
                  @change="diagnosisKnown(diagnosisFormIndex, '脑出血')"
                >脑出血</el-checkbox>
                <el-checkbox
                  v-model="diagnosisForm[diagnosisFormIndex].isuia"
                  true-label="1"
                  false-label=""
                  @change="diagnosisKnown(diagnosisFormIndex, '颅内动脉瘤')"
                >颅内动脉瘤</el-checkbox>
                <el-checkbox
                  v-model="diagnosisForm[diagnosisFormIndex].cas"
                  true-label="1"
                  false-label=""
                  @change="
                    diagnosisKnown(diagnosisFormIndex, '颈动脉狭窄或闭塞')
                  "
                >颈动脉狭窄或闭塞</el-checkbox>
              </div>
            </el-row>
            <!-- <el-row class="card-content">
            <div class="radio-flex-small">
              <el-checkbox v-model="diagnosisForm[diagnosisFormIndex].avm" true-label="1" false-label="2"
                @change="diagnosisKnown(diagnosisFormIndex)">
                动静脉畸形AVM
              </el-checkbox>
              <el-checkbox v-model="diagnosisForm[diagnosisFormIndex].mmd" true-label="1" false-label="2"
                @change="diagnosisKnown(diagnosisFormIndex)">
                烟雾病
              </el-checkbox>
            </div>
          </el-row> -->
            <el-row class="card-content">
              <div class="radio-flex">
                <el-checkbox
                  v-model="diagnosisForm[diagnosisFormIndex].giveUp"
                  true-label="1"
                  false-label=""
                  @change="
                    diagnosisUnknown(diagnosisFormIndex, '病因未明放弃治疗')
                  "
                >
                  病因未明放弃治疗
                </el-checkbox>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>
      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].cerebralInfarction == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">TOAST 分型</div>
          <div v-if="toastForm.length === 0">
            <el-button type="primary" @click="addComplication()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="toastForm.length === 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-form
          v-for="(toastFormItem, toastFormIndex) in toastForm"
          :key="'toast' + toastFormIndex"
          :model="toastFormItem"
          label-width="80px"
        >
          <el-row class="card">
            <el-row class="card-title" type="flex">
              <el-col :sm="22" class="right">
                <div class="content">{{ toastFormItem.createdAt }}</div>
                <div class="content">{{ toastFormItem.department }}</div>
              </el-col>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-radio
                  v-model="toastFormItem.toast"
                  label="LAA"
                  @change="toastCheck(toastFormIndex)"
                >
                  大动脉粥样硬化性卒中（LAA）
                </el-radio>
                <el-radio
                  v-model="toastFormItem.toast"
                  label="CE"
                  @change="toastCheck(toastFormIndex)"
                >
                  心源性脑栓塞（CE）
                </el-radio>
                <el-radio
                  v-model="toastFormItem.toast"
                  label="SAA"
                  @change="toastCheck(toastFormIndex)"
                >
                  小动脉闭塞性卒中或腔隙性卒中（SAA）
                </el-radio>
                <el-radio
                  v-model="toastFormItem.toast"
                  label="SOE"
                  @change="toastCheck(toastFormIndex)"
                >
                  其他原因所致的缺血性卒中（SOE）
                </el-radio>
                <el-radio
                  v-model="toastFormItem.toastMMD"
                  label="1"
                  @change="toastMMDCheck(toastFormIndex)"
                >
                  烟雾病
                </el-radio>
                <el-radio
                  v-model="toastFormItem.toast"
                  label="SUE"
                  @change="toastCheck(toastFormIndex)"
                >
                  不明原因的缺血性卒中（SUE）
                </el-radio>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>

      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].hematencephalon == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">病因诊断</div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addComplication()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length === 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-row class="card">
          <el-form
            v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
            :key="'diagnosis' + diagnosisFormIndex"
            :model="diagnosisForm[diagnosisFormIndex]"
            label-width="80px"
          >
            <el-row class="card-content">
              <el-row class="card-title" type="flex">
                <el-col :sm="22" class="right">
                  <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                  <div class="content">{{ diagnosisFormItem.department }}</div>
                </el-col>
              </el-row>
              <el-row class="card-content">
                <div class="radio-flex">
                  <el-checkbox-group v-model="naodiag">
                    <el-checkbox
                      v-for="item in naodiagList"
                      :key="item"
                      :label="item"
                    >
                      {{ item }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>
              </el-row>
            </el-row>
          </el-form>
        </el-row>
      </el-row>

      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].hematencephalon == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">是否脑疝</div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addComplication()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length === 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-form
          v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
          :key="'diagnosis' + diagnosisFormIndex"
          :model="diagnosisForm[diagnosisFormIndex]"
          label-width="80px"
        >
          <el-row class="card-content">
            <el-row class="card">
              <el-row class="card-title" type="flex">
                <el-col :sm="22" class="right">
                  <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                  <div class="content">{{ diagnosisFormItem.department }}</div>
                </el-col>
              </el-row>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-radio-group
                  v-model="diagnosisForm[diagnosisFormIndex].fast"
                >
                  <el-radio label="1"> 是 </el-radio>
                  <el-radio label="2"> 否 </el-radio>
                </el-radio-group>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>
      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].isuia == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">有无既往动脉瘤破裂史</div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addComplication()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length === 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-form
          v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
          :key="'diagnosis' + diagnosisFormIndex"
          :model="diagnosisForm[diagnosisFormIndex]"
          label-width="80px"
        >
          <el-row class="card-content">
            <el-row class="card">
              <el-row class="card-title" type="flex">
                <el-col :sm="22" class="right">
                  <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                  <div class="content">{{ diagnosisFormItem.department }}</div>
                </el-col>
              </el-row>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-radio-group
                  v-model="diagnosisForm[diagnosisFormIndex].essen"
                >
                  <el-radio label="1"> 有 </el-radio>
                  <el-radio label="2"> 无 </el-radio>
                </el-radio-group>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>
      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].isuia == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">动脉瘤临床分类</div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addComplication()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length === 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-form
          v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
          :key="'diagnosis' + diagnosisFormIndex"
          :model="diagnosisForm[diagnosisFormIndex]"
          label-width="80px"
        >
          <el-row class="card-content">
            <el-row class="card">
              <el-row class="card-title" type="flex">
                <el-col :sm="22" class="right">
                  <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                  <div class="content">{{ diagnosisFormItem.department }}</div>
                </el-col>
              </el-row>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-radio-group
                  v-model="diagnosisForm[diagnosisFormIndex].abcd2"
                >
                  <el-radio label="1"> 本次破裂致蛛网膜下腔出血 </el-radio>
                  <el-radio label="2">
                    本次破裂蛛网膜下腔出血合并脑出血
                  </el-radio>
                  <el-radio label="3"> 未破裂 </el-radio>
                </el-radio-group>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>

      <el-row
        v-if="
          diagnosisForm.length > 0 &&
            diagnosisForm[diagnosisFormIndex].cas == '1'
        "
        class="form"
      >
        <el-row class="form-row" type="flex" justify="space-between">
          <div class="form-title required-field">
            颈动脉狭窄或闭塞是否有症状
          </div>
          <div v-if="diagnosisForm.length === 0">
            <el-button type="primary" @click="addDiagnosis()">
              新增
            </el-button>
          </div>
        </el-row>
        <el-row v-if="diagnosisForm.length == 0" class="no-data">
          <h3 align="center">无数据</h3>
        </el-row>
        <el-form
          v-for="(diagnosisFormItem, diagnosisFormIndex) in diagnosisForm"
          :key="'diagnosis' + diagnosisFormIndex"
          :model="diagnosisForm[diagnosisFormIndex]"
          label-width="80px"
        >
          <el-row class="card-content">
            <el-row class="card">
              <el-row class="card-title" type="flex">
                <el-col :sm="22" class="right">
                  <div class="content">{{ diagnosisFormItem.createdAt }}</div>
                  <div class="content">{{ diagnosisFormItem.department }}</div>
                </el-col>
              </el-row>
            </el-row>
            <el-row class="card-content">
              <div class="radio-flex">
                <el-radio-group v-model="jdmxz_state">
                  <el-radio label="1"> 有（缺血症状或脑梗死） </el-radio>
                  <el-radio label="2"> 无 </el-radio>
                </el-radio-group>
              </div>
            </el-row>
          </el-row>
        </el-form>
      </el-row>
    </div>

    <el-dialog
      title="新增初步诊断"
      :visible.sync="openAddDiagnosis"
      custom-class="estimateAddDialog"
      width="900px"
      center
      @open="addDiagnosisOpen"
    >
      <el-form :model="addDiagnosisForm" label-width="80px">
        <el-row class="card" :style="border">
          <el-row class="card-content">
            <div class="radio-flex">
              <el-checkbox-group v-model="addDiagnosisForm.diagnosisDisease">
                <el-checkbox
                  v-for="item in diagnosisDiseaseList"
                  :key="item.diagnosisDiseaseCode"
                  :label="item.diagnosisDiseaseCode"
                  @change="disableTia()"
                >
                  {{ item.diagnosisDiseaseName }}
                </el-checkbox>
              </el-checkbox-group>
            </div>
          </el-row>

          <el-row class="card-content">
            <div class="radio-flex">
              <el-radio
                v-model="addDiagnosisForm.giveUp"
                label="1"
                @change="diagnosisUnknown2()"
              >
                病因未明放弃治疗
              </el-radio>
            </div>
          </el-row>
        </el-row>
        <div
          v-if="
            addDiagnosisForm.diagnosisDisease &&
              addDiagnosisForm.diagnosisDisease.indexOf(
                'cerebralInfarction'
              ) !== -1
          "
        >
          <el-form-item label-width="115px" label="TOAST分型" required />
          <el-row class="card" :style="border">
            <el-form :model="addDiagnosisForm" label-width="80px">
              <el-row class="card-content">
                <div class="radio-flex">
                  <el-radio
                    v-model="addDiagnosisForm.toast"
                    label="LAA"
                    @change="toastCheck()"
                  >
                    大动脉粥样硬化性卒中（LAA）
                  </el-radio>
                  <el-radio
                    v-model="addDiagnosisForm.toast"
                    label="CE"
                    @change="toastCheck()"
                  >
                    心源性脑栓塞（CE）
                  </el-radio>
                  <el-radio
                    v-model="addDiagnosisForm.toast"
                    label="SAA"
                    @change="toastCheck()"
                  >
                    小动脉闭塞性卒中或腔隙性卒中（SAA）
                  </el-radio>
                  <el-radio
                    v-model="addDiagnosisForm.toast"
                    label="SOE"
                    @change="toastCheck()"
                  >
                    其他原因所致的缺血性卒中（SOE）
                  </el-radio>
                  <el-radio
                    v-model="addDiagnosisForm.toastMMD"
                    label="1"
                    @change="toastMMDCheck()"
                  >
                    烟雾病
                  </el-radio>
                  <el-radio
                    v-model="addDiagnosisForm.toast"
                    label="SUE"
                    @change="toastCheck()"
                  >
                    不明原因的缺血性卒中（SUE）
                  </el-radio>
                </div>
              </el-row>
            </el-form>
          </el-row>
        </div>
        <div
          v-if="
            addDiagnosisForm.diagnosisDisease &&
              addDiagnosisForm.diagnosisDisease.indexOf('hematencephalon') !==
              -1
          "
        >
          <el-form-item label-width="100px" label="病因诊断" required />
          <el-row class="card" :style="border">
            <el-form :model="addDiagnosisForm" label-width="80px">
              <el-row class="card-content">
                <div class="radio-flex">
                  <el-checkbox-group
                    v-model="addDiagnosisForm.naodiag"
                    @change="changenaodiag(addDiagnosisForm.naodiag,addDiagnosisForm)"
                  >
                    <el-checkbox label="高血压" value="高血压">
                      高血压
                    </el-checkbox>
                    <el-checkbox label="动静脉畸形AVM" value="动静脉畸形AVM">
                      动静脉畸形AVM
                    </el-checkbox>
                    <el-checkbox label="血管淀粉样变性" value="血管淀粉样变性">
                      血管淀粉样变性
                    </el-checkbox>
                    <el-checkbox label="颅内动脉瘤" value="颅内动脉瘤">
                      颅内动脉瘤
                    </el-checkbox>
                    <el-checkbox label="硬脑膜动静脉痿" value="硬脑膜动静脉瘘">
                      硬脑膜动静脉痿
                    </el-checkbox>
                    <el-checkbox label="烟雾病" value="烟雾病">
                      烟雾病
                    </el-checkbox>
                    <el-checkbox label="海绵状血管瘤" value="海绵状血管瘤">
                      海绵状血管瘤
                    </el-checkbox>
                    <el-checkbox
                      label="颅内静脉窦血栓形成"
                      value="颅内静脉窦血栓形成"
                    >
                      颅内静脉窦血栓形成
                    </el-checkbox>
                    <el-checkbox label="其他" value="其他"> 其他 </el-checkbox>
                  </el-checkbox-group>
                </div>
              </el-row>
            </el-form>
          </el-row>
          <el-form :model="addDiagnosisForm" label-width="80px">
            <el-form-item label-width="115px" label="是否脑疝：" required>
              <el-radio-group v-model="addDiagnosisForm.fast">
                <el-radio label="1"> 是 </el-radio>
                <el-radio label="2"> 否 </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <div
          v-if="
            addDiagnosisForm.diagnosisDisease &&
              addDiagnosisForm.diagnosisDisease.indexOf('isuia') !== -1
          "
        >
          <el-form :model="addDiagnosisForm" label-width="80px">
            <el-form-item
              label-width="190px"
              label="有无既往动脉瘤破裂史："
              required
            >
              <el-radio-group v-model="addDiagnosisForm.essen">
                <el-radio label="1"> 有 </el-radio>
                <el-radio label="2"> 无 </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>

          <el-form :model="addDiagnosisForm" label-width="80px">
            <el-form-item label-width="150px" label="动脉瘤临床分类：" required>
              <el-radio-group v-model="addDiagnosisForm.abcd2">
                <el-radio label="1"> 本次破裂致蛛网膜下腔出血 </el-radio>
                <el-radio label="2"> 未破裂 </el-radio>
                <el-radio label="3">
                  本次破裂致蛛网膜下腔出血合并脑出血
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <div
          v-if="
            addDiagnosisForm.diagnosisDisease &&
              addDiagnosisForm.diagnosisDisease.indexOf('cas') !== -1
          "
        >
          <el-form :model="addDiagnosisForm" label-width="80px">
            <el-form-item
              label-width="250px"
              label="颈动脉狭窄或闭塞是否有症状："
              required
            >
              <el-radio-group v-model="jdmxz_state">
                <el-radio label="1" value="1">有（缺血症状或脑梗死）</el-radio>
                <el-radio label="2" value="2">无</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>

      </el-form>
      <div slot="footer">
        <el-button @click="openAddDiagnosis = false">取 消</el-button>
        <el-button
          type="primary"
          @click="addDiagnosisConfirm(addDiagnosisForm, '1')"
        >
          确 定
        </el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="新增TOAST 分型"
      :visible.sync="openAddComplication"
      custom-class="estimateAddDialog"
      width="900px"
      center
      @open="addComplicationOpen"
    >
      <el-row class="card" :style="border">
        <el-form :model="addComplicationForm" label-width="80px">
          <el-row class="card-content">
            <div class="radio-flex">
              <el-radio
                v-model="addComplicationForm.toast"
                label="LAA"
                @change="toastCheck()"
              >
                大动脉粥样硬化性卒中（LAA）
              </el-radio>
              <el-radio
                v-model="addComplicationForm.toast"
                label="CE"
                @change="toastCheck()"
              >
                心源性脑栓塞（CE）
              </el-radio>
              <el-radio
                v-model="addComplicationForm.toast"
                label="SAA"
                @change="toastCheck()"
              >
                小动脉闭塞性卒中或腔隙性卒中（SAA）
              </el-radio>
              <el-radio
                v-model="addComplicationForm.toast"
                label="SOE"
                @change="toastCheck()"
              >
                其他原因所致的缺血性卒中（SOE）
              </el-radio>
              <el-radio
                v-model="addComplicationForm.toastMMD"
                label="1"
                @change="toastMMDCheck()"
              >
                烟雾病
              </el-radio>
              <el-radio
                v-model="addComplicationForm.toast"
                label="SUE"
                @change="toastCheck()"
              >
                不明原因的缺血性卒中（SUE）
              </el-radio>
            </div>
          </el-row>
        </el-form>
      </el-row>
      <div slot="footer">
        <el-button @click="openAddComplication = false">取 消</el-button>
        <el-button
          type="primary"
          @click="addDiagnosisConfirm(addComplicationForm, '3')"
        >
          确 定
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Check from '@/components/scoreRow/Check'
import Row from '@/components/scoreRow/Row'
import {
  selectScoreClassAll,
  saveScores,
  selectScores,
  updateScores,
  findStrokeDiagnose,
  saveStrokeDiagnose
} from '@/api/green-channel/diagnoses'
export default {
  name: 'DiagnosticEstimateStroke',
  components: {
    Row,
    Check
  },

  props: {
    checkrowdata: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      border: {
        border: '1px dashed #DCDFE6',
        'border-radius': '4px',
        'margin-bottom': '10px',
        'padding-top': '10px',
        'padding-left': '30px'
      },
      jdmxz_state: '',
      list: [],
      scoreList: [],
      scoresList: [],
      select: '',
      openAddDialog: false,
      addDiagnosisForm: { naodiag: [], diagnosisDisease: [] },
      openAddDiagnosis: false,
      addComplicationForm: {},
      openAddComplication: false,
      addGrade: '',
      addMark: '',
      timer: '',
      // 确诊诊断
      diagnosisForm: [],
      // FAST 评分
      fastForm: [],
      // GCS 评分
      gcsForm: [],
      // toast分型
      toastForm: [],
      // 卒中类型
      diagnosisTypeList: [
        {
          diagnosisTypeName: '首发卒中',
          diagnosisTypeCode: '1'
        },
        {
          diagnosisTypeName: '醒后卒中',
          diagnosisTypeCode: '2'
        }
      ],
      // 诊断疾病
      diagnosisDiseaseList: [
        {
          diagnosisDiseaseName: '脑梗死',
          diagnosisDiseaseCode: 'cerebralInfarction'
        },
        {
          diagnosisDiseaseName: '脑出血',
          diagnosisDiseaseCode: 'hematencephalon'
        },
        {
          diagnosisDiseaseName: '颅内动脉瘤',
          diagnosisDiseaseCode: 'isuia'
        },
        {
          diagnosisDiseaseName: '颈动脉狭窄或闭塞',
          diagnosisDiseaseCode: 'cas'
        }
      ],
      // FAST 评分List 11
      fastList: [
        {
          fastItemName: '面瘫',
          fastItemList: [
            {
              fastName: '正常或轻微面瘫',
              fastCode: '0'
            },
            {
              fastName: '部分或完全面瘫',
              fastCode: '1'
            }
          ]
        },
        {
          fastItemName: '上肢无力',
          fastItemList: [
            {
              fastName: '无瘫痪',
              fastCode: '0'
            },
            {
              fastName: '有瘫痪/抗部分重力',
              fastCode: '1'
            },
            {
              fastName: '不能抗重力/无活动',
              fastCode: '2'
            }
          ]
        },
        {
          fastItemName: '言语障碍',
          fastItemList: [
            {
              fastName: '无语言障碍',
              fastCode: '0'
            },
            {
              fastName: '轻-中度',
              fastCode: '1'
            },
            {
              fastName: '严重，全面失语，缄默',
              fastCode: '2'
            }
          ]
        },
        {
          fastItemName: '强迫凝视',
          fastItemList: [
            {
              fastName: '无',
              fastCode: '0'
            },
            {
              fastName: '部分',
              fastCode: '1'
            },
            {
              fastName: '强迫凝视',
              fastCode: '2'
            }
          ]
        },
        {
          fastItemName: '失认/忽视',
          fastItemList: [
            {
              fastName: '无',
              fastCode: '0'
            },
            {
              fastName: '不能感知双侧同时的中感觉刺激',
              fastCode: '1'
            },
            {
              fastName: '不能识别自己的手或仅能感知一侧肢体',
              fastCode: '2'
            }
          ]
        }
      ],
      // 洼田 12
      swallowList: [
        {
          swallowName: 'I级 任何条件下均有吞咽困难和不能吞咽',
          swallowCode: '1'
        },
        {
          swallowName: 'II级 3个条件均具备则误吸减少',
          swallowCode: '2'
        },
        {
          swallowName: 'III级 具备2个条件则误吸减少',
          swallowCode: '3'
        },
        {
          swallowName: 'IV级 入选者适当食物,则基本上无误吸',
          swallowCode: '4'
        },
        {
          swallowName: 'V级 入注意进食方法和时间基本上无误吸',
          swallowCode: '5'
        },
        {
          swallowName: 'VI级 吞咽正常',
          swallowCode: '6'
        }
      ],
      // fisher 评分List 13
      fisherList: [
        {
          fisherName: '0级 规出血或仅脑室内出血或脑实质内出血; 3% (CVS可能性)',
          fisherCode: '0'
        },
        {
          fisherName: 'I级 仅观基底池出血; 14%',
          fisherCode: '1'
        },
        {
          fisherName: 'II级 仅见周边脑池或侧裂池出血; 38%',
          fisherCode: '2'
        },
        {
          fisherName: 'III级 广泛蛛网膜下腔出血伴脑实质内血肿; 57%',
          fisherCode: '3'
        },
        {
          fisherName: 'IV级 基底池和周边脑池、侧裂池较厚积血。57%',
          fisherCode: '4'
        }
      ],
      // mRS评分 14,15
      mrsList: [
        {
          mrsName: '完全无症状',
          mrsCode: '0'
        },
        {
          mrsName: '尽管有症状，但无明显功能障碍，能完成所有日常工作和生活',
          mrsCode: '1'
        },
        {
          mrsName:
            '轻度残疾，不能完成病前所有活动，但不需帮助能照顾自己的日常生活',
          mrsCode: '2'
        },
        {
          mrsName: '中度残疾，需部分帮助，但能独立行走',
          mrsCode: '3'
        },
        {
          mrsName: '重度残疾，不能独立行走，无他人帮助不能满足自身日常生活需求',
          mrsCode: '4'
        },
        {
          mrsName:
            '严重残疾，持续卧床、二便失禁，需持续护理和关注，日常生活完全依赖他人',
          mrsCode: '5'
        }
      ],
      // gcs评分
      gcsList: [
        {
          gcsItemName: '睁眼',
          gcsItemList: [
            {
              gcsName: '无睁眼',
              gcsCode: '1'
            },
            {
              gcsName: '疼痛刺激睁眼',
              gcsCode: '2'
            },
            {
              gcsName: '语言刺激睁眼',
              gcsCode: '3'
            },
            {
              gcsName: '自发睁眼',
              gcsCode: '4'
            }
          ]
        },
        {
          gcsItemName: '语言',
          gcsItemList: [
            {
              gcsName: '无发音',
              gcsCode: '1'
            },
            {
              gcsName: '只能发音',
              gcsCode: '2'
            },
            {
              gcsName: '只能说（不适当）单词',
              gcsCode: '3'
            },
            {
              gcsName: '言语错乱',
              gcsCode: '4'
            },
            {
              gcsName: '正常交谈',
              gcsCode: '5'
            }
          ]
        },
        {
          gcsItemName: '运动',
          gcsItemList: [
            {
              gcsName: '无反应',
              gcsCode: '1'
            },
            {
              gcsName: '异常伸展（去脑状态）',
              gcsCode: '2'
            },
            {
              gcsName: '异常屈曲（去皮层状态）',
              gcsCode: '3'
            },
            {
              gcsName: '对疼痛刺激屈曲反应',
              gcsCode: '4'
            },
            {
              gcsName: '对疼痛刺激定位反应',
              gcsCode: '5'
            },
            {
              gcsName: '按吩咐动作',
              gcsCode: '6'
            }
          ]
        }
      ],
      // Hunt-Hess 评级 19
      huntHessList: [
        {
          huntHessName: '0级 未破裂动脉瘤',
          huntHessCode: '0'
        },
        {
          huntHessName: 'I级 无症状或轻微头痛',
          huntHessCode: '1'
        },
        {
          huntHessName: 'II级 中一重度头痛.  脑膜刺激征.颅神经麻痹',
          huntHessCode: '2'
        },
        {
          huntHessName: 'III级 嗜睡，意识混浊，轻度局灶神经体征',
          huntHessCode: '3'
        },
        {
          huntHessName:
            'IV级 昏迷，中或重度偏瘫，有早期去脑强直或自主神经功能紊乱',
          huntHessCode: '4'
        },
        {
          huntHessName: 'V级 深昏迷，去大脑强直，濒死状态',
          huntHessCode: '5'
        }
      ],
      // CHADS2 评分 20
      chads2List: [
        { chads2Name: '既往充血性心力衰竭( CHF )病史', chads2Code: '1' },
        { chads2Name: '高血压', chads2Code: '1' },
        { chads2Name: '年龄≥75岁', chads2Code: '1' },
        { chads2Name: '糖尿病', chads2Code: '1' },
        { chads2Name: 'TIA或卒中病史', chads2Code: '2' }
      ],
      // HAS-BLED 评分 21
      bledList: [
        { bledName: '高血压病', bledCode: '1' },
        { bledName: '肾功能异常', bledCode: '2' },
        { bledName: '肝功能异常', bledCode: '3' },
        { bledName: '先前有过卒中', bledCode: '4' },
        { bledName: '有出血史或出血倾向', bledCode: '5' },
        { bledName: '有过INR值不稳定历史', bledCode: '6' },
        { bledName: '老年年龄≥65岁', bledCode: '7' },
        { bledName: '合用阿司匹林或NSAIDs药物', bledCode: '8' },
        { bledName: '酗酒', bledCode: '9' }
      ],
      // toast分型 3
      toastList: [
        {
          toastName: '大动脉粥样硬化性卒中（LAA）',
          toastCode: 'LAA'
        },
        {
          toastName: '心源性脑栓塞（CE）',
          toastCode: 'CE'
        },
        {
          toastName: '小动脉闭塞性卒中或腔隙性卒中（SAA）',
          toastCode: 'SAA'
        },
        {
          toastName: '其他原因所致的缺血性卒中（SOE）',
          toastCode: 'SOE'
        },
        {
          toastName: '不明原因的缺血性卒中（SUE）',
          toastCode: 'SUE'
        }
      ],
      scoreCard: false,
      score: [], // 初步诊断
      hasData: false,
      diagnosisDisease: [],
      naodiag: [],

      naodiagList: [
        '高血压',
        '动静脉畸形AVM',
        '烟雾病',
        '血管淀粉样变性',
        '颅内动脉瘤',
        '硬脑膜动静脉瘘',
        '海绵状血管瘤',
        '颅内静脉窦血栓形成',
        '其他'
      ]
    }
  },
  created() {
    this.findStrokeDiagnose()
    console.log("this.checkrowdata",this.checkrowdata.diagnoseContent)
    this.selectScoreClassAll()
  },

  methods: {
    initField() {
      this.diagnosisForm = []
      this.fastForm = []
      this.gcsForm = []
      this.toastForm = [{}]
      this.score = []
    },
    findStrokeDiagnose() {
      findStrokeDiagnose({
        dispatchId: this.checkrowdata.dispatchId
      }).then(res => {
        this.initField()
        const scoreList = res.data.filter(
          item => item.type && item.type !== '1' && item.type !== '3'
        )
        if (scoreList.length > 0) {
          this.hasData = true
        }
        res.data.forEach(item => {
          if (item.type === '1') {
            if (
              this.deleteField(item).naodiag &&
              this.deleteField(item).naodiag.length >= 2
            ) {
              this.naodiag = this.deleteField(item)
                .naodiag.split('|')
                .filter(ele => ele !== '')

              this.jdmxz_state = this.deleteField(item).swallow
                ? this.deleteField(item).swallow.toString()
                : this.deleteField(item).swallow
            }
            this.diagnosisForm.push(this.deleteField(item))
            let temp_arr = []
            if(item.cerebralInfarction === "1"){
              temp_arr.push("脑梗死")
            }
            if(item.hematencephalon === "1"){
              temp_arr.push("脑出血")
            }
            if(item.isuia === "1"){
              temp_arr.push("颅内动脉瘤")
            }
            if(item.cas === "1"){
              temp_arr.push("颈动脉狭窄或闭塞")
            }
            if(temp_arr.length>0){
              this.checkrowdata.diagnoseContent = temp_arr.join(",")
            }else{
              this.checkrowdata.diagnoseContent = ""
            }
          } else if (item.type === '11') {
            if (item.fast) {
              const arr = item.fast.split('|')
              arr.forEach((arrEl, index) => {
                item['fastScore' + index] = arrEl
              })
            }
            this.fastForm.push(item)
          } else if (item.type === '16') {
            if (item.beGCS) {
              const arr = item.beGCS.split('|')
              arr.forEach((arrEl, index) => {
                item['beGCSScore' + index] = arrEl
              })
            }
            this.gcsForm.push(item)
          } else if (item.type === '18') {
            if (item.inGCS) {
              const arr = item.inGCS.split('|')
              arr.forEach((arrEl, index) => {
                item['inGCSScore' + index] = arrEl
              })
            }
            this.gcsForm.push(item)
          } else if (item.type === '22') {
            if (item.outGCS) {
              const arr = item.outGCS.split('|')
              arr.forEach((arrEl, index) => {
                item['outGCSScore' + index] = arrEl
              })
            }
            this.gcsForm.push(item)
          } else if (item.type === '3') {
            console.log('item3', item)
            for (const key in this.deleteField(item)) {
              this.toastList.forEach(el => {
                if (el.toastCode === key) {
                  item[key] = ''
                  this.$set(item, 'toast', el.toastCode)
                }
              })
            }
            console.log('item', item)
            this.toastForm = []
            this.toastForm.push(this.deleteField(item))
            console.log('toastForm', this.toastForm)
          } else {
            this.score.push(this.deleteField(item))
          }
          if (item.type === '20') {
            if (item.inCHADS2) {
              const arr = item.inCHADS2.split('|')
              arr.forEach((arrEl, index) => {
                // item['inCHADS2Score' + index] = arrEl
                this.$set(item, ['inCHADS2Score' + index], arrEl)
              })
            }
          }
          if (item.type === '21') {
            if (item.HASBLED) {
              const arr = item.HASBLED.split('|')
              arr.forEach((arrEl, index) => {
                this.$set(item, ['HASBLEDScore' + index], arrEl)
              })
            }
          }
        })
        if (
          this.fastForm.length > 0 ||
          this.score.length > 0 ||
          this.gcsForm.length > 0
        ) {
          this.scoreCard = true
        }
      })
    },
    diagnosisUnknown(index, value) {
      console.log(this.diagnosisForm[index], value)
      if (index === 0 || index) {
        this.$set(this.diagnosisForm[index], 'stroketype', '')
        this.$set(this.diagnosisForm[index], 'sah', '2')
        this.$set(this.diagnosisForm[index], 'tia', '2')

        this.$set(this.diagnosisForm[index], 'cerebralInfarction', '')
        this.$set(this.diagnosisForm[index], 'hematencephalon', '')
        this.$set(this.diagnosisForm[index], 'isuia', '')
        this.$set(this.diagnosisForm[index], 'cas', '')
      } else {
        this.$set(this.addDiagnosisForm, 'stroketype', '')
        this.$set(this.addDiagnosisForm, 'sah', '2')
        this.$set(this.addDiagnosisForm, 'tia', '2')
      }
    },
    diagnosisUnknown2() {
      this.addDiagnosisForm = { naodiag: [], diagnosisDisease: [], giveUp: '1' }
    },
    diagnosisKnown(index, value) {
      if (!this.naodiag.includes(value)) {
        this.naodiag.push(value)
      } else {
        if (this.naodiag.indexOf(value) !== -1) {
          this.naodiag.splice(this.naodiag.indexOf(value), 1)
        }
      }

      console.log(this.naodiag)
      console.log('index', index)
      if (index === 0 || index) {
        console.log(
          'this.diagnosisForm[index].giveUp',
          this.diagnosisForm[index].giveUp
        )
        if (this.diagnosisForm[index].giveUp === '1') {
          this.diagnosisForm[index].giveUp = ''
          // console.log(
          //   "this.addDiagnosisForm.diagnosisDiseas",
          //   this.addDiagnosisForm.diagnosisDiseas
          // );
        }
        if (
          this.diagnosisForm[index].tia === '1' &&
          this.diagnosisForm[index].diagnosisDisease.indexOf(
            'cerebralInfarction'
          ) !== -1
        ) {
          this.diagnosisForm[index].diagnosisDisease = []
        }
      }

      // else {
      //   if (this.addDiagnosisForm.diagnosisDisease.indexOf("giveUp") !== -1) {
      //     this.addDiagnosisForm.diagnosisDisease = [];
      //     console.log('this.addDiagnosisForm.diagnosisDiseas',this.addDiagnosisForm.diagnosisDiseas)
      //   }
      //   if (
      //     this.addDiagnosisForm.tia === "1" &&
      //     this.addDiagnosisForm.diagnosisDisease.indexOf(
      //       "cerebralInfarction"
      //     ) === -1
      //   ) {
      //     this.addDiagnosisForm.diagnosisDisease = [];
      //   }
      // }
    },
    disableTia(index) {
      if (index === 0 || index) {
        if (
          this.diagnosisForm[index].tia === '1' &&
          this.diagnosisForm[index].diagnosisDisease.indexOf(
            'cerebralInfarction'
          ) !== -1
        ) {
          this.diagnosisForm[index].tia = '2'
        }
      } else {
        if (
          this.addDiagnosisForm.tia === '1' &&
          this.addDiagnosisForm.diagnosisDisease.indexOf(
            'cerebralInfarction'
          ) !== -1
        ) {
          this.addDiagnosisForm.tia = '2'
        }
        if (this.addDiagnosisForm.giveUp == '1') {
          this.addDiagnosisForm.giveUp = 0
        }
      }
      // console.log(this.addDiagnosisForm.diagnosisDisease);
    },
    toastCheck(index) {
      if (index === 0 || index) {
        this.$set(this.toastForm[index], 'toastMMD', '')
      } else {
        this.$set(this.addComplicationForm, 'toastMMD', '')
      }
    },
    toastMMDCheck(index) {
      if (index === 0 || index) {
        if (this.toastForm[index].toastMMD === '1') {
          this.toastForm[index].toast = 'SOE'
        }
      } else {
        if (this.addComplicationForm.toastMMD === '1') {
          this.$set(this.addComplicationForm, 'toast', 'SOE')
        }
      }
    },
    multipleChoice(field, data) {
      data[field] = ''
      for (const key in data) {
        if (key.indexOf(field + 'Score') > -1) {
          data[field] += data[key]
        }
      }
      if (data[field]) {
        data[field] = data[field].split('').join('|')
      }
    },
    saveOther(data, type, data2) {
      console.log('saveOther', data, type, data2)
      if (!type) {
        if (this.naodiag.length >= 1) {
          data.naodiag = '|' + this.naodiag.join('|') + '|'
        } else {
          data.naodiag = this.naodiag
        }
      }
      data.swallow = this.jdmxz_state
      if (data.naodiag.length === 0) {
        data.naodiag = ''
      }
      const datalist = []
      datalist.push(data)
      if (data.cerebralInfarction) {
        if (this.toastForm.length > 0) {
          // console.log("this.toastForm[0]",this.toastForm[0])
          if(!this.toastForm[0].createdAt || !this.toastForm[0].department || !this.toastForm[0].dispatchId || !this.toastForm[0].id || !this.toastForm[0].medicalId || !this.toastForm[0].medicalId || !this.toastForm[0].updatedAt || !this.toastForm[0].userId || !this.toastForm[0].type){
            this.toastForm[0].createdAt = data.createdAt
            this.toastForm[0].department = this.checkrowdata.department
            this.toastForm[0].dispatchId = this.checkrowdata.dispatchId
            this.toastForm[0].id = this.checkrowdata.id
            this.toastForm[0].medicalId = this.checkrowdata.medicalId
            this.toastForm[0].updatedAt = data.updatedAt
            this.toastForm[0].userId = this.checkrowdata.userId
            this.toastForm[0].type = "3"
          }
          this.toastForm[0][this.toastForm[0].toast] = 1
          datalist.push(this.toastForm[0])
        }
      }

      // if(data.hematencephalon){
      //   if(this.diagnosisForm.length>0){
      //     datalist.push(this.diagnosisForm[0])
      //   }
      // }
      // if(data.isuia){
      //   datalist.push(this.diagnosisForm[0])
      // }
      // if(data.cas){

      // }
      // if(data.giveUp){

      // }
      // data = this.deleteField(data)
      // if (data2) {
      //   this.saveStrokeDiagnose([data2, data])
      // } else {
      this.saveStrokeDiagnose(datalist)
      // }

      // if (diagnosisDiseaseFlag) {

      // } else {
      //   this.$message.warning('请选择卒中类型')
      // }
    },

    saveStrokeDiagnose(data) {
      saveStrokeDiagnose(data).then(res => {
        if (res.code === 0) {
          this.$message.success('保存成功')
          this.openAddDiagnosis = false
          this.openAddComplication = false
          this.findStrokeDiagnose()
        } else {
          this.$message.error('保存失败1')
        }
      })
    },
    deleteField(data) {
      for (const key in data) {
        if (!data[key]) {
          delete data[key]
        }
      }
      return data
    },
    // 获取所有评分模板数据-接口
    selectScoreClassAll() {
      selectScoreClassAll({
        pageNum: 1,
        pageSize: 0,
        greenType: this.checkrowdata.diseaseType,
        hospitalId: this.$store.getters.hospitalId,
        type: ''
      }).then(res => {
        // console.log(res,'res')
        if (res.code === 0) {
          const arr = res.data.list
          arr.forEach(item => {
            item.floor = '0'
          })

          this.list = arr
          const selectList = arr.filter(item => item.status !== '0')
          if (selectList.length > 0) {
            this.select = selectList[0].id
          }
          this.gradeInit()
          this.selectScores()
        } else {
          this.$message.error('查询评分模板失败')
        }
      })
    },
    // 查询评分数据-接口
    selectScores() {
      selectScores({
        dispatchId: this.checkrowdata.dispatchId,
        pageNum: 1,
        pageSize: 0
      }).then(res => {
        if (res.code === 0) {
          this.scoresList = res.data.list
          this.scoreList = []
          res.data.list.forEach(item => {
            this.list.forEach(el => {
              if (parseInt(item.scoreClassAId) === el.id) {
                el.grade = this.compareRange(
                  el.scoreConclusionList,
                  item.score
                )
                el.mark = item.score
                el.score = item
                this.scoreList.push(JSON.parse(JSON.stringify(el)))
              }
            })
          })
          this.scoreSetProcess()
          if (this.scoreList.length > 0) {
            this.hasData = true
          }

          this.timer = new Date().getTime()
        } else {
          this.$message.error('查询评分失败')
        }
      })
    },
    scoreSetProcess() {
      this.scoreList.forEach(item => {
        item.data = item.score.index + '||' + item.score.score
        this.scoreSetSort(item.scoreClassList, item.score)
      })
    },
    scoreSetSort(list, score) {
      for (let i = 0; i < list.length; i++) {
        if (list[i].fieldType === 'content') {
          return false
        } else {
          if (!this.scoreSetSort(list[i].scoreClassList, score)) {
            list[i].data = score.index + '||' + score.score
          }
        }
      }
      return true
    },
    // 添加评分数据字段
    addConfirm() {
      const obj = this.scoreProcess(
        this.scoreSort(this.list.filter(data => data.id === this.select))
      )
      obj.grade = this.compareRange(
        arr[0].scoreConclusionList,
        this.addMark,
        true
      )
      obj.mark = this.addMark
      obj.userId = this.checkrowdata.userId
      obj.dispatchId = this.checkrowdata.dispatchId
      obj.medicalId = this.checkrowdata.medicalId
      obj.scoreClassAId = this.select
      if (!obj.index) {
        this.$message.error('没有选中的选项无法添加')
      } else {
        this.saveScores(obj)
      }
    },
    // 添加评分-接口
    saveScores(obj) {
      saveScores(obj).then(res => {
        if (res.code === 0) {
          this.openAddDialog = false
          this.$message.success('新增成功')
          this.selectScoreClassAll()
        } else {
          this.$message.error('新增失败')
        }
      })
    },
    // 收取评分数据
    scoreSort(list) {
      let arr = []
      for (let i = 0; i < list.length; i++) {
        if (list[i].data) {
          arr.push(list[i].data)
        } else {
          arr = arr.concat(this.scoreSort(list[i].scoreClassList))
        }
      }
      return arr
    },
    // 评分数据处理
    scoreProcess(arr) {
      const indexArr = []
      let score = ''
      arr.forEach(el => {
        if (el.indexOf('||') > 0) {
          indexArr.push(el.split('||')[0])
          if (!score) {
            score = parseInt(el.split('||')[1])
          } else {
            score += parseInt(el.split('||')[1])
          }
        } else {
          indexArr.push(el)
        }
      })
      return {
        index: indexArr.join(','),
        score: score
      }
    },
    // 获取比较分值的结论
    compareRange(list, score, flag) {
      if (list.length === 0) {
        if (!flag) {
          return '未录入描述信息，请联系医院管理员'
        } else {
          return ''
        }
      }
      if (!score && score != 0) {
        return ''
      }
      for (let i = 0; i < list.length; i++) {
        const max = score + list[i].maxcondition + list[i].maximum
        const min = score + list[i].mincondition + list[i].minimum
        if (this.calculator(min) && this.calculator(max)) {
          return list[i].conclusion
        }
      }
      if (!flag) {
        return '所得分值无对应结论，请联系医院管理员'
      } else {
        return ''
      }
    },
    // 字符串比较计算器
    calculator(str) {
      return new Function('return (' + str + ')')()
    },
    // 打开新增弹框
    openAdd() {
      if (this.list.length > 0) {
        this.openAddDialog = true
      } else {
        this.$message.error('未录入评分模板')
      }
    },
    // 修改评分数据
    save(item) {
      const obj = this.scoreProcess(this.scoreSort([item]))
      obj.id = item.score.id
      obj.userId = this.checkrowdata.userId
      obj.dispatchId = this.checkrowdata.dispatchId
      obj.medicalId = this.checkrowdata.medicalId
      obj.scoreClassAId = item.id
      obj.grade = this.compareRange(item.scoreConclusionList, obj.score, true)
      if (item.status !== '0') {
        this.updateScores(obj)
      } else {
        this.$message.error('此评分已禁用，不允许修改')
      }
    },
    updateScores(obj) {
      updateScores(obj).then(res => {
        if (res.code === 0) {
          this.$message.success('保存成功')

          this.selectScoreClassAll()
        } else {
          this.$message.error('保存失败2')
        }
      })
    },
    gradeInit() {
      this.addGrade = ''
    },
    getAddGrade(item) {
      const obj = this.scoreProcess(this.scoreSort([item]))
      this.addMark = obj.score
      if (item.scoreConclusionList) {
        this.addGrade = this.compareRange(item.scoreConclusionList, obj.score)
      }
    },
    getGradeSpan(item, index) {
      const obj = this.scoreProcess(this.scoreSort([item]))
      this.scoreList[index].mark = obj.score
      this.scoreList[index].grade = this.compareRange(
        item.scoreConclusionList,
        obj.score
      )
    },
    addDiagnosis() {
      this.openAddDiagnosis = true
    },
    addComplication() {
      this.openAddComplication = true
      this.addComplicationForm = {}
    },
    addDiagnosisConfirm(field, type) {
      console.log('this.checkrowdata', this.checkrowdata)
      console.log('this.$store.getters', this.$store.getters)
      field.department = this.checkrowdata.departmentName
      field.userId = this.$store.getters.userId
      // field.id = this.$store.getters.userId
      field.medicalId = this.checkrowdata.medicalId
      field.dispatchId = this.checkrowdata.dispatchId
      this.$set(field, 'remark', '')
      this.$set(field, 'naodiag', '')
      this.$set(field, 'remark', '')
      this.$set(field, 'remarks', '')
      if (field.naodiag_tmp) {
        this.$set(field, 'naodiag', field.naodiag_tmp)
      }
      field.type = type

      field.diagnosisDisease.forEach(el => {
        if (el === 'cas') {
          this.$set(field, 'cas', '1')
        } else if (el === 'hematencephalon') {
          this.$set(field, 'hematencephalon', '1')
        } else if (el === 'isuia') {
          this.$set(field, 'isuia', '1')
        } else if (el === 'cerebralInfarction') {
          this.$set(field, 'cerebralInfarction', '1')
        }
      })
      let field2 = ''
      if (field['cerebralInfarction']) {
        field2 = {
          department: this.checkrowdata.departmentName,
          dispatchId: this.checkrowdata.dispatchId,
          userId: this.$store.getters.userId,
          // id: this.$store.getters.userId,
          medicalId: this.checkrowdata.medicalId,
          remark: '',
          remarks: '',
          type: '3'
        }
        if (field.toast) {
          this.$set(field2, field.toast, 1)
          if (field.toastMMD) {
            this.$set(field2, 'toastMMD', 1)
          }
        }
      }
      console.log('field', field)
      console.log('field2', field2)
      this.saveOther(field, 1, field2)
    },
    addDiagnosisOpen() {
      this.addDiagnosisForm = { naodiag: [], diagnosisDisease: [] }
      this.$set(this.addDiagnosisForm, 'sah', '2')
      this.$set(this.addDiagnosisForm, 'tia', '2')
      // this.$set(this.addDiagnosisForm, 'avm', '2')
      // this.$set(this.addDiagnosisForm, 'mmd', '2')
    },
    addComplicationOpen() {
      this.addComplicationForm = {}
    },
    changenaodiag(value, value1) {
      this.addDiagnosisForm.naodiag_tmp = value.join('|')
      console.log(this.addDiagnosisForm.naodiag_tmp)
    }
  }
}
</script>

<style lang="scss" scoped>
.body {
  padding-left: 20px;
  padding-right: 20px;

  .no-data {
    padding: 20px 40px;
  }

  .title {
    margin-bottom: 12px;
    font-size: 20px;
    color: #1890ff;

    .crumb {
      display: flex;
      align-items: center;
    }
  }

  .form {
    margin: 0px 25px 20px 15px;
    padding-bottom: 0px;
    border: 1px solid #dcdfe6;

    &-title {
      display: flex;
      align-items: center;
      line-height: 36px;
    }

    &-row {
      padding-right: 20px;
      padding: 12px 30px;
      border-bottom: 1px solid #dcdfe6;
    }
  }

  .card {
    margin: -1px 45px 0px 35px;
    padding: 10px 20px 0px 10px;
    border-top: 1px dashed #dcdfe6;
    border-radius: 4px;

    &-title,
    &-subTitle {
      margin-bottom: 10px;
      font-size: 15px;

      .right {
        display: flex;
        justify-content: flex-end;

        div {
          padding-left: 20px;
        }
      }

      .content {
        display: flex;
        align-items: center;
      }
    }

    &-subTitle {
      padding: 7px 0;
    }

    &-content {
      padding-left: 30px;
      font-size: 14px !important;

      .el-radio {
        min-width: 80px;
      }

      .radio-flex,
      .radio-flex-small {
        .small-distance {
          margin-right: 0px;
          min-width: 60px !important;
        }

        .el-radio {
          min-width: 110px;
          margin: 0px 20px 20px 0px;
        }

        .el-checkbox {
          margin: 0px 10px 20px 0px !important;
          min-width: 226.3px;
        }
      }

      .radio-flex-small {
        .el-checkbox {
          min-width: 110px;
        }
      }

      .check {
        width: 750px;
      }

      &-result {
        margin: 0px 0px 20px;
      }

      .radio-box .el-radio {
        min-width: 230px;
        padding: 3px 0;
      }

      &-title {
        display: flex;
        flex: 0 0 45px;
        align-items: center;
      }

      &-subTitle {
        display: flex;
        flex: 0 0 45px;
      }

      .inspect {
        width: 750px;
      }

      .project {
        width: 1000px;
      }

      .result-grade {
        .el-input {
          width: 280px;
        }
      }

      .result-score {
        padding-left: 20px;
        padding-right: 10px;

        .el-input {
          width: 50px;
        }
      }
    }

    .item {
      padding-top: 6px;
      padding-bottom: 6px;
    }
  }
}

.required-field:before {
  content: "*";
  color: red;
  margin-right: 2px;
}
</style>
